//
//  JXHWelcomeViewController.swift
//  JXHSinaWeiBo
//
//  Created by juxiaohui on 16/10/20.
//  Copyright © 2016年 juxiaohui. All rights reserved.
//

import UIKit
import SDWebImage


class JXHWelcomeViewController: UIViewController {

    @IBOutlet weak var bottomConstraint: NSLayoutConstraint!
    @IBOutlet weak var avatar: UIImageView!
    
    override func viewDidLoad() {
        super.viewDidLoad()

        self.avatar.layer.cornerRadius = 42.5
        self.avatar.layer.masksToBounds = true
        
        let profileUrl = JXHUserAcccountTool.shareInstance.accont?.avatar_large
        
        let url = URL.init(string: profileUrl ?? "")
        
        avatar.sd_setImage(with: url, placeholderImage: UIImage.init(named: "avatar_default_big"))
    }

    
    override func viewDidAppear(_ animated: Bool) {
        
        super.viewDidAppear(animated)
        
        bottomConstraint.constant = UIScreen.main.bounds.height - 200
        
        UIView.animate(withDuration:1.5, delay: 0.0, usingSpringWithDamping: 0.7, initialSpringVelocity: 5.0, options: [], animations: {
            self.view.layoutIfNeeded()
        }) { (_) in
            UIApplication.shared.keyWindow?.rootViewController = UIStoryboard.init(name: "Main", bundle: nil).instantiateInitialViewController()    
        }
    }
}
